﻿<%@ Page Title="Add Shopping List" Language="C#" MasterPageFile="~/Resources/AAMMaster.master"
    AutoEventWireup="true" CodeBehind="addshoppinglist.aspx.cs" Inherits="LMKJ.addshoppinglist" %>

<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
    <div class="form_name">
        Shopping List Management
    </div>
    <table style="width: 100%">
        <tr>
            <td colspan="2">
                <asp:CustomValidator ID="fieldsValidator" runat="server" Display="Dynamic" ErrorMessage="Some fields are empty! All fields are required to create a shopping list!"
                    ForeColor="Red" OnServerValidate="fieldsValidator_ServerValidate" ValidationGroup="AddShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>Resident&#39;s NRIC</b>
            </td>
            <td>
                <asp:TextBox ID="nricTbx" runat="server" Width="100px" MaxLength="9"></asp:TextBox>
                <asp:CustomValidator ID="residentValidator" runat="server" Display="Dynamic" ErrorMessage="Resident does not exist!"
                    ForeColor="Red" OnServerValidate="residentValidator_ServerValidate" ValidationGroup="AddShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>Date Required</b>
            </td>
            <td>
                <asp:DropDownList ID="monthDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="monthDdl_SelectedIndexChanged">
                    <asp:ListItem>Month</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="dayDdl" runat="server" Enabled="False">
                    <asp:ListItem>Day</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="yearDdl" runat="server" Enabled="False">
                    <asp:ListItem>Year</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:CustomValidator ID="dateValidator" runat="server" Display="Dynamic" ErrorMessage="Date must be at least 7 days later than today!"
                    ForeColor="Red" OnServerValidate="dateValidator_ServerValidate" ValidationGroup="AddShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>List of Items </b>
            </td>
            <td>
                Item Name:
                <asp:DropDownList ID="existingItemsDdl" runat="server" Width="75%">
                </asp:DropDownList>
                <br />
                Quantity:
                <asp:TextBox ID="quantityTbx" runat="server" Width="50px" Text="0"></asp:TextBox>
                <asp:CustomValidator ID="qtyValidator" runat="server" OnServerValidate="qtyValidator_ServerValidate"
                    Display="Dynamic" ErrorMessage="Please input numbers only!" ForeColor="Red"
                    ValidationGroup="EditShoppingList"></asp:CustomValidator>
                <br />
                <asp:Button ID="addItemToLboxBtn" runat="server" Text="Add" OnClick="addItemToLboxBtn_Click"
                    CssClass="buttonAdd" />
                <asp:Button ID="removeItemFromLboxBtn" runat="server" Text="Remove" OnClick="removeItemFromLboxBtn_Click"
                    CssClass="buttonRemove" />
                <br />
                <asp:ListBox ID="itemsListLbox" runat="server" Width="100%" SelectionMode="Multiple">
                </asp:ListBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="addBtn" runat="server" Text="Add Shopping List" OnClick="addBtn_Click"
                    CssClass="buttonAddList" ValidationGroup="AddShoppingList" />
                <asp:Button ID="cancelBtn" runat="server" Text="Cancel" OnClick="cancelBtn_Click"
                    CssClass="buttonCancel" CausesValidation="False" />
            </td>
        </tr>
    </table>
</asp:Content>
